package com.ai.manager.edu.cms.user.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ai.dao.edu.cms.user.RoleMenuMapper;
import com.ai.manager.edu.cms.user.RoleMenuManager;
import com.ai.model.edu.cms.backoperator.RoleMenu;
import com.ai.model.edu.cms.backoperator.vo.MenuCountVO;
import com.ai.model.edu.cms.backoperator.vo.RoleMenuVO;

@Component("roleMenuManager")
public class RoleMenuManagerImpl implements RoleMenuManager {

    @Resource
    private RoleMenuMapper roleMenuMapper;

    public int deleteByPrimaryKey(Long id) {
        return roleMenuMapper.deleteByPrimaryKey(id);
    }

    public int insert(RoleMenu record) {
        return roleMenuMapper.insert(record);
    }

    public List<RoleMenu> selectByRoleId(Long roleId) {
        return roleMenuMapper.selectByRoleId(roleId);
    }

    public int updateByPrimaryKey(RoleMenu record) {
        return roleMenuMapper.updateByPrimaryKey(record);
    }

    /**
     * Description ： 根据角色ids 查询角色对应的菜单<br>
     * 
     * yangwb
     * 
     * @param roleIds
     * @return
     * @since
     *
     */
    public List<RoleMenuVO> findRoleMunuVOsByRoleIds(List<Long> roleIds) {
        return roleMenuMapper.findRoleMunuVOsByRoleIds(roleIds);
    }

    /**
     * Description ： 根据角色ID统计菜单信息
     * 
     * nyj
     * 
     * @param roleIds
     * @return
     * @since
     *
     */
    public List<MenuCountVO> countMenuByRoleIds(List<Long> roleIds) {
        return roleMenuMapper.countMenuByRoleIds(roleIds);
    }

    /**
     * Description ： 根据角色ID删除角色菜单关系
     * 
     * nyj
     * 
     * @param roleId
     * @return
     * @since
     *
     */
    public Integer deleteRoleMenuByRoleId(Long roleId) {
        return roleMenuMapper.deleteRoleMenuByRoleId(roleId);
    }
}